var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            if (cm.isQuestActive(41106)) {
                if (cm.haveItem(4033819, 5)) {
                    cm.sendOk("（已经拿了足够多干草了，喂奶牛吧。）")
                } else {
                    cm.sendNormalTalk("在干草堆里拿了一捆干草。", 0, 2430017, false, true);
                    cm.gainItem(4033819, 1)
                }
            } else {
                cm.sendOk("（一大堆干草）");
                cm.dispose()
            }
        } else {
            if (cm.getItemQuantity(4033819) < 2) {
                cm.sendNormalTalk("不过，奶牛那个块头这么点草应该不够吧。还是多拿点吧。", 2, 2430017, true, true)
            }
            cm.dispose()
        }
    }
}

function action控制中心(mode, type, selection) {
    var reactor = "action" + cm.getNpc();
    eval(reactor)(mode, type, selection)
}

function action分支(mode, type, selection) {
    if (status == 0 && mode == 0) {
        cm.dispose();
        return
    }(mode == 1) ? status++ : status--;
    selectionLog[status] = selection;
    var i = -1;
    if (status <= i++) {
        cm.dispose()
    } else {
        if (status === i++) {
            cm.askMenu("你需要我的帮助吗？\r\n\r\n#b#L0#分支0#l#k\r\n#b#L1#分支1#l#k\r\n\r\n#b#L2#分支2l#k", 0, 9400965)
        } else {
            var reactor = "action分支" + selectionLog[1];
            eval(reactor)(mode, type, selection, i)
        }
    }
}

function action分支1(d, c, b, a) {
    if (status <= a++) {
        cm.sendNormalTalk("分支1。", 0, 9400965, false, false)
    } else {
        if (status === a++) {
            cm.dispose()
        }
    }
};